<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://www.ufida.com/multilang" prefix="ml" %>
<%@ page import="nc.bs.framework.common.InvocationInfoProxy" %>
<%@ taglib uri="http://www.ufida.com/lfw" prefix="lfw" %>
<%@ page import="nc.lfw.util.LanguageUtil"%>
<%@ page import="nc.bs.framework.common.InvocationInfoProxy" %>
<%
	String langCode = LanguageUtil.getLangIdByCookie(request);
	pageContext.setAttribute("langCode", langCode);
	InvocationInfoProxy.getInstance().setLangCode(langCode); 
	
	String maxWindow = nc.lfw.util.CookieUtil.get(request.getCookies(), "maxWindow");
	if(maxWindow == null)
		maxWindow = "0";
	//boolean isMaxWindow = (maxWindow != null && maxWindow.equal("1"));
	pageContext.setAttribute("maxWindow", maxWindow);
	
	String compressStream = nc.lfw.util.CookieUtil.get(request.getCookies(), "compressStream");
	//boolean isCompressStream = (compressStream == null || compressStream.equal("1"));
	if(compressStream == null)
		compressStream = "1";
	pageContext.setAttribute("compressStream", compressStream);
	
%>
<html> 
	<head>
		<lfw:base/>
		<lfw:head/>
		<title>
			NC网上报销
		</title>
		<lfw:import/>
		<script type='text/javascript' src='${ROOT_PATH}/code/nclogin'></script>
		<script type='text/javascript' src='${ROOT_PATH}/html/nodes/login/login.js'></script>
		<link rel='STYLESHEET' type='text/css' href='${ROOT_PATH}/html/nodes/login/themes/webclassic/stylesheets/loginbutton.css'>
		
		<style>
			.topbg{
				filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#76B1F5, EndColorStr=#F4F9FE);
				background:#9AC5F8 !important;
			}
			
			.bottombg{
				filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#F4F9FE, EndColorStr=#BEDDFB);
				background:#9AC5F8 !important;
			}
			
			.formtable{
				filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#F5FaFF, EndColorStr=#F4F9FE);
			}
			
			.loggingleft{
				background:url('html/nodes/login/themes/webclassic/images/logging-left.png');
				_background:none;
				_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${ROOT_PATH}/html/nodes/login/themes/webclassic/images/logging-left.png');
				width:9px;
				height:100%;
			}
			
			.loggingright{
				background:url('html/nodes/login/themes/webclassic/images/logging-right.png');
				_background:none;
				_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${ROOT_PATH}/html/nodes/login/themes/webclassic/images/logging-right.png');
				width:9px;
				height:100%;
			}
			
			.logodiv{
				background:url('html/nodes/login/themes/webclassic/images/logging-logo.png');
				_background:none;
				_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${ROOT_PATH}/html/nodes/login/themes/webclassic/images/logging-logo.png');
				width:201px;
				height:41px;
			}
			
		</style>
		
	</head>
	<body leftmargin="0" topmargin="0" scroll="no" onload="pageBodyScript();">
		<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
			<tr height="65%">
				<td class="topbg" align="right">
					<div class="loggingleft"></div>
				</td>
				<td rowspan="2" width="535px">
					<table width="100%" height="100%" cellspacing="0" cellpadding="0">
						<tr height="117px">
							<td width="535px" style="background:url('html/nodes/login/themes/webclassic/images/logging-in.gif') no-repeat" valign="bottom" align="left">
								<div class="logodiv"><div>
								<div>&nbsp;</div>
							</td>
						</tr>
						<tr>
							<td  class="formtable">
								<lfw:pageModel className="nc.lfw.finance.login.WebbxLoginPageModel" modelId="nclogin" >
									<lfw:layout type="flowv" border="0">
										<lfw:layoutPanel height="40px">
											<table id="error_table" bgcolor="FFF0C2" cellpadding="0" cellspacing="1" style="border-style:solid;border-width:1;border-color:B69204;padding-left:5;padding-right:15;visibility:hidden">
												<tr height="22px">
													<td><img src="html/nodes/login/images/warn.gif"></td>
													<td nowrap="nowrap">
														&nbsp;${errorcode}
													</td>
												</tr>
											</table>
										</lfw:layoutPanel>
									    <lfw:layoutPanel align="center" valign="top">
									    	<c:choose>
										    	<c:when test="${langcode eq 'english'}">
										    		<div style="width:250px"><lfw:form id="nclogin_form"/></div>
										    	</c:when>
										    	<c:otherwise>
									    			<div style="width:200px"><lfw:form id="nclogin_form"/></div>
									    		</c:otherwise>
									    	</c:choose>
										    </lfw:layoutPanel>
									    <lfw:layoutPanel valign="top" align="left">
									       <lfw:layout type="flowh" border="0">
									       		<lfw:layoutPanel width="198px">
									       			&nbsp;
									    		</lfw:layoutPanel>
									            <lfw:layoutPanel valign="top" width="70">
									       			<lfw:button id="submitBtn"/>
									       		</lfw:layoutPanel>
									       		<lfw:layoutPanel width="22px">
									       			&nbsp;
									    		</lfw:layoutPanel>
									       		<lfw:layoutPanel valign="top" width="70">
									       			<lfw:button id="optionBtn"/>
									    		</lfw:layoutPanel>
									    		<lfw:layoutPanel>
									    			&nbsp;
									    		</lfw:layoutPanel>
									    	</lfw:layout>
									    </lfw:layoutPanel>
									    <lfw:layoutPanel>
									    	<table id="option_table" style="visibility:hidden" border="0" width="200">
									    		<tr>
									    			<td><input type="checkbox" id="compressStream" name="compressStream"  ${compressStream eq '1' ? "checked" : ""} /></td><td>${ml:trans('yer_login001')}</td>
									    		</tr>
									    		<tr>
									    			<td><input name="maxWindow" id="maxWindowBox" type="checkbox" ${maxWindow eq '1' ? "checked" : ""}/></td><td>${ml:trans('yer_login002')}</td>
									    		</tr>
									    	</table>
									    </lfw:layoutPanel>
									    <lfw:layoutPanel height="10px" >
									    	<div style="font-size:14px;color:#46719E">
												&nbsp;&nbsp;<font>${ml:trans('yer_login005')}<a name="down" style="cursor: hand" href="/Client/FoxitReaderProV3.0.exe" target="_blank">${ml:trans('yer_login006')}</a>${ml:trans('yer_login007')}</font>
											</div>
									    </lfw:layoutPanel>
									    <lfw:layoutPanel height="15" valign="bottom" align="center">
									    	<div id="progressdiv" style="width:100%;height:15px;display:none;">
									    		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="html/nodes/login/images/progress.gif" />
									    	</div>
									    </lfw:layoutPanel>
									    <lfw:layoutPanel height="100%">
									    </lfw:layoutPanel>
									</lfw:layout>
								</lfw:pageModel>
							</td>
						</tr>
						<tr height="35%">
							<td class="bottombg">
								<table width="100%" height="100%" border="0">
									<tr valign="bottom" align="right">
										<td><img src="html/nodes/login/themes/webclassic/images/ufida-logo.png"/></td>
									</tr>
									<tr height="15px">
										<td></td>
									</tr>
									<tr height="42px">
										<td align="center" valign="top"><span style="font-size:12px;color:#46719E">${ml:trans('yer_copyright')}</span></td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
				<td class="topbg" align="left">
					<div class="loggingright"></div>
				</td>
			</tr>
			<tr height="35%">
				<td class="bottombg"></td><td class="bottombg"></td>
			</tr>
		</table>
		
		<script>
			try{
				//防止嵌套在自己框架内
				if(parent.bxmainpage != null)
					parent.location.href = window.location.href;
			}
			catch(error){
			}
			window.moveTo(-4,-4);   
			window.resizeTo(screen.availWidth + 8, screen.availHeight + 8);
			
			<c:if test="${not empty errorcode}">
				showErrorMsg("${errorcode}");
			</c:if>
			setScreenToSession();

			function externalInit()
			{
				hideProgressBar();
				var loginUIType= getSessionAttribute('loginUIType');
				var form = getComponent("nclogin_form");
				form.getElement("userId").onenter = function(){
					if(form.getElement("userId").getValue().trim() == ''){
						showMsgTable("${ml:trans('yer_login003')}");
						return;
					}
					form.getElement("password").setFocus();
				};
				form.getElement("workdate").onenter = function(){
					form.getElement("userId").setFocus();
				};
				form.getElement("password").innerProcessEnter = function(){
					valid();
				};
				
				if(loginUIType == "0"){//普通登录模式=0
					form.getElement("corpName").onenter = function(){
						form.getElement("workdate").setFocus();
					};
				} 
				
				form.getElement("userId").onblur = function(){
					if(form.getElement("userId").getValue().trim() == ''){
						showMsgTable("${ml:trans('yer_login003')}");
						return;
					}					
					cleanMsgTable();
				}
				form.getElement("workdate").onblur = function(){
					if(form.getElement("workdate").getValue().trim() == ''){
						showMsgTable("${ml:trans('yer_login_datenotnull')}");//日期不能为空!
						return;
					}					
					cleanMsgTable();
				}
			}

			function submitCallback(xmlHttpReq, returnArgs) {
				var str = xmlHttpReq.responseText;
				var v = str.split("$");
				if(v[0] == "0"){
					var win = null;
					// 最大化打开窗口
					if($("maxWindowBox").checked){
						win = window.open( window.corePath + getMainUrl(v) + (Math.random()*10000).toString().substring(0, 4), null, "toolbar=no,menubar=no,scrollbar=yes,resizable=yes,location=no,status=no,fullscreen=no,left=0,top=0,width=" + window.screen.width + ",height=" + window.screen.height);
						if(win != window && win != null)
							toClose();
					}
					// 在本窗口打开
					else
						window.location.href = window.corePath + getMainUrl(v) + (Math.random()*10000).toString().substring(0, 4);
				}
				else if(v[0] == "6"){
					cancelLogin.errinfo = v[1];
					ConfirmDialogComp.showDialog("${ml:trans('yer_login004')}", forceLogin,cancelLogin,null,null,null,null);
				}else if(v[0] == '-1'){
					var url = getCorePath() + "/login/login2.jsp?pageId=login2&isLoginDlg=true&rand=" + (Math.random()*10000).toString().substring(0, 4);
					showDialog(url , "${ml:trans('yer_login_selectcorp')}", "270", "180", "login2dlg", false, false);
				}
				else {
					showMsgTable(v[1]);
				}
			}
			function getMainUrl(v){
				var mainType = v[2];
				if(mainType == 'weblogic')
					return "/main/home.jsp?pageId=main&randId=";
				else
					return "/main/main.jsp?pageId=main&randId=";
			}
		</script>
	</body>

</html>
